#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/features/moment_of_inertia_estimation.h>
#include <pcl/common/transforms.h>
#include <pcl/io/pcd_io.h> //PCL的PCD格式文件的输入输出头文件
#include <pcl/point_types.h> //PCL对各种格式的点的支持头文件
#include <pcl/visualization/cloud_viewer.h>//点云查看窗口头文件
#include <boost/thread.hpp>

#include "vtkActor.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include <vtkNew.h>
#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkAxesActor.h>
#include <vtkOrientationMarkerWidget.h>
#include "vtkConeSource.h"
#include "vtkCamera.h"
#include <vtkProperty.h>
#include <QSurfaceFormat>
#include "QVTKOpenGLNativeWidget.h"

#include "cloudpointprocess.h"


#include <vector>
#include <QVector>


QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void init_point_cloud_show();

private slots:
    void rgbSliderReleased( );
    void pointSliderReleased( );
    void pSliderValueChangeed(int value);
    void redSliderValueChangeed(int value);
    void greenSliderValueChangeed(int value);
    void blueSliderValueChangeed(int value);
    void updateCameraView(double focalPoint[3], double position[3], double viewUp[3]);
    void show_point_count(int value);
    void compute_bounding_box();
    void compute_min_bounding_box();
    void receive_cloud_point(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &cloud_t);


    void on_pushButton_clicked();

    void on_pushButton_rainbow_clicked();

    void on_pushButton_front_clicked();

    void on_pushButton_back_clicked();

    void on_pushButton_left_clicked();

    void on_pushButton_right_clicked();

    void on_pushButton_top_clicked();

    void on_pushButton_down_clicked();

    void on_checkBox_CoordinateSystem_stateChanged(int arg1);

    void on_checkBox_stateChanged(int arg1);

    void on_checkBox_bbox_stateChanged(int arg1);

    void on_checkBox_min_bbox_stateChanged(int arg1);

    void on_pushButton_update_cloud_stream_clicked();

    void on_pushButton_close_cloud_point_stream_clicked();

private:
    Ui::MainWindow *ui;
    int red;
    int green;
    int blue;
    int size;
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud;
    pcl::visualization::PCLVisualizer::Ptr viewer;
    vtkSmartPointer<vtkOrientationMarkerWidget> MarkerWidget;
    CloudPointProcess *m_cloud_thread;
    typedef pcl::PointXYZ PointT;
    typedef pcl::PointCloud<PointT> PointCloudT;
    PointCloudT::Ptr cloud1;
    PointCloudT::Ptr cloud2;
    std::vector <PointCloudT::Ptr> Cloud_c;
    QVector<PointCloudT::Ptr> Cloud_p;
    int cloud_total;
    int half_cloud_total;
    int_fast64_t clockCount;

};
#endif // MAINWINDOW_H
